package com.springframework.DI_t.basicDataType_DI;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class BasicDataTypeRun {
    public static void main(String[] args) {
//        构造器进行注入
        Book book = new Book("刺","李尚龙",null);
        System.out.println(book);
        System.out.println(book.getBookName()+","+book.getBookAuthor());
//        set方法进行注入
        book.setBookName("周易");
        book.setBookAuthor("~");
        System.out.println(book.getBookName()+","+book.getBookAuthor());
//        spring的注入
        ApplicationContext context = new ClassPathXmlApplicationContext("com.springframework/DI_t/bean.xml");
        Book book1 = (Book) context.getBean("book",Book.class);
        System.out.println(book1);
        System.out.println(book1.getBookName());
        System.out.println(book1.getBookAuthor());
    }
}